import axios from 'axios'
import getters from '@/store/getters'

const instance = axios.create({
  baseURL: 'http://localhost:8081/apis',
  // baseURL: '/apis',
  timeout: 600000
});

export default instance;
// 拦截请求
instance.interceptors.request.use(
  config => {
    // 有 token就带上
    if (window.localStorage.getItem('token')) {
      config.headers.Authorization = window.localStorage.getItem('token')
    }
    // console.log(config)
    return config
  },
  error => {
    console.log(error)
  }
)
